package tt.dz.egobus.servicemanager.business.filter;

import tt.dz.egobus.servicemanager.business.distance.PointFilter;
import tt.dz.egobus.servicemanager.business.point.BusPoint;
import tt.dz.egobus.servicemanager.business.point.Point;
import tt.dz.egobus.servicemanager.business.point.PointAlgorithmHelp;

/**
 * @author Anson
 * @date 17-8-8
 * @name
 * @since 1.0.6
 */
public class MaxLimitPointFilter implements PointFilter {

    private final int maxLimit;
    //当前坐标
    private final Point point;

    public MaxLimitPointFilter(int maxLimit, Point point) {
        this.maxLimit = maxLimit;
        this.point = point;
    }

    @Override
    public boolean isFilter(BusPoint busPoint) {
        double accDistance = PointAlgorithmHelp.getDistance(point, busPoint);
        return accDistance <= maxLimit;
    }
}
